package cn.dm.controller;

import cn.dm.common.Dto;
import cn.dm.pojo.DmUser;
import cn.dm.service.LocalUserService;
import cn.dm.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class LoginController {

    @Resource
    private LocalUserService localUserService;
    @Resource
    private LoginService loginService;


    /**
     * ### 手机号密码登录接口
     * >说明:本接口用于用户使用用户名和密码登录
     * @param dmUser
     * @return
     * @throws Exception
     */
    @PostMapping("/user/api/p/login")
    public Dto login(@RequestBody DmUser dmUser) throws Exception {
        log.info("=====>用户登录请求执行");
        log.info(dmUser.getPassword());
        log.info(dmUser.getPhone());
        return loginService.login(dmUser);
    }
}
